#include "vertex_buffer.h"

#include "renderer.h"

VertexBuffer::VertexBuffer(const void *data, uint32_t size)
{
    GLCALL(glGenBuffers(1, &rendererID_));
    GLCALL(glBindBuffer(GL_ARRAY_BUFFER, rendererID_));
    GLCALL(glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW));
}

VertexBuffer::~VertexBuffer()
{
    GLCALL(glDeleteBuffers(1, &rendererID_));
}

void VertexBuffer::Bind() const
{
    GLCALL(glBindBuffer(GL_ARRAY_BUFFER, rendererID_));
}

void VertexBuffer::Unbind() const
{
    GLCALL(glBindBuffer(GL_ARRAY_BUFFER, 0));
}
